﻿<helpers:PhonePageBase x:Class="Flowers.DetailsPage"
                       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                       xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                       xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                       xmlns:viewModel="clr-namespace:Flowers.Data.ViewModel;assembly=Flowers.Data"
                       xmlns:helpers="clr-namespace:Flowers.Helpers"
                       FontFamily="{StaticResource PhoneFontFamilyNormal}"
                       FontSize="{StaticResource PhoneFontSizeNormal}"
                       Foreground="{StaticResource PhoneForegroundBrush}"
                       SupportedOrientations="Portrait"
                       Orientation="Portrait"
                       mc:Ignorable="d"
                       shell:SystemTray.IsVisible="True"
                       d:DataContext="{d:DesignInstance Type=viewModel:FlowerViewModel, IsDesignTimeCreatable=True}">

    <helpers:PhonePageBase.Resources>
        <DataTemplate x:Key="CommentDataTemplate">
            <StackPanel Margin="0,0,0,12">
                <TextBlock TextWrapping="Wrap"
                           Text="{Binding Text}"
                           FontSize="24" />

                <TextBlock Text="{Binding InputDate}"
                           FontSize="16"
                           Margin="0,7,0,0" />
                <Rectangle Fill="{StaticResource HighlightBrush}"
                           Height="1"
                           Opacity="0.5"
                           Margin="0,6,0,0" />
            </StackPanel>
        </DataTemplate>
    </helpers:PhonePageBase.Resources>

    <Grid x:Name="LayoutRoot"
          Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0"
                    Margin="12,17,0,28">
            <TextBlock Text="{StaticResource ApplicationName}"
                       Style="{StaticResource PhoneTextNormalStyle}" />

            <TextBlock Text="{Binding Model.Name}"
                       Margin="9,-7,106,0"
                       Style="{StaticResource PhoneTextTitle1Style}"
                       TextWrapping="Wrap"
                       FontSize="48"
                       Foreground="{StaticResource HighlightBrush}" />
        </StackPanel>

        <Grid x:Name="ContentPanel"
              Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>

            <ScrollViewer Grid.Row="1">
                <StackPanel Margin="24,0">
                    <TextBlock TextWrapping="Wrap"
                               Text="{Binding Model.Description}"
                               FontSize="24" />
                    <Rectangle Fill="{StaticResource HighlightBrush}"
                               Height="2"
                               Margin="0,12" />

                    <ItemsControl ItemsSource="{Binding Model.Comments}"
                                  ItemTemplate="{StaticResource CommentDataTemplate}" />
                </StackPanel>
            </ScrollViewer>

            <Image HorizontalAlignment="Left"
                   Height="200"
                   VerticalAlignment="Top"
                   Width="200"
                   Source="{Binding ImageUri, Mode=OneWay}"
                   Margin="24,0,0,12" />

            <Button Content="Add Comment"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Top"
                    Command="{Binding AddCommentCommand, Mode=OneWay}"
                    Margin="0,0,12,0" />

        </Grid>

        <Image Style="{StaticResource IconStyle}" />
    </Grid>
</helpers:PhonePageBase>